<div>
  Defines a logical expression which determines which agents may execute builds
  of this project. This expression, when tested against the name and labels of
  each available agent, will be either
  <i>true</i>
  or
  <i>false</i>
  . If the expression evaluates to
  <i>true</i>
  , then that agent will be allowed to execute builds of this project.
  <p>
    If this project should always be built on a specific agent, or on the
    built-in node, then you can just enter the agent's name, or
    <code>built-in</code>
    , respectively.
  </p>

  <p>
    However, you should generally avoid using the
    <i>Name</i>
    of an agent here, preferring to target the
    <i>Labels</i>
    of an agent. As documented on the configuration page for each agent, and the
    <i>Configure System</i>
    page for the master, labels can be used to represent which operating system
    the agent is running on, its CPU architecture, or any number of other
    characteristics.
    <br />
    Using labels removes the need to re-configure the label expression entered
    here each time that you add, remove, or rename agents.
  </p>

  <p>
    A label expression can be as simple as entering a single
    <b>label</b>
    or
    <b>agent name</b>
    , for example
    <code>android-builder</code>
    , or
    <code>linux-machine-42</code>
    .
    <br />
    You can also make use of various
    <i>operators</i>
    to create more complex expressions.
  </p>

  <h3>Supported operators</h3>
  The following operators are supported, in descending order of precedence:
  <dl>
    <dt><code>(expression)</code></dt>
    <dd>
      parentheses — used to explicitly define the associativity of an expression
    </dd>

    <dt><code>!expression</code></dt>
    <dd>
      NOT — negation; the result of
      <code>expression</code>
      must
      <b>not</b>
      be true
    </dd>

    <dt><code>a &amp;&amp; b</code></dt>
    <dd>
      AND —
      <b>both</b>
      of the expressions
      <code>a</code>
      and
      <code>b</code>
      must be true
    </dd>

    <dt><code>a || b</code></dt>
    <dd>
      OR —
      <b>either</b>
      of the expressions
      <code>a</code>
      or
      <code>b</code>
      may be true
    </dd>

    <dt><code>a -> b</code></dt>
    <dd>
      "implies" operator — equivalent to
      <code>!a || b</code>
      .
      <br />
      For example,
      <code>windows -> x64</code>
      could be thought of as "if a Windows agent is used, then that agent
      <i>must</i>
      be 64-bit", while still allowing this project to be executed on any agents
      that
      <i>do not</i>
      have the
      <code>windows</code>
      label, regardless of whether they have also have an
      <code>x64</code>
      label
    </dd>

    <dt><code>a &lt;-> b</code></dt>
    <dd>
      "if and only if" operator — equivalent to
      <code>a &amp;&amp; b || !a &amp;&amp; !b</code>
      <br />
      For example,
      <code>windows &lt;-> dc2</code>
      could be thought of as "if a Windows agent is used, then that agent
      <i>must</i>
      be in datacenter 2, but if a non-Windows agent is used, then it
      <i>must not</i>
      be in datacenter 2"
    </dd>
  </dl>

  <h3>Notes</h3>
  <ul>
    <li>
      All operators are left-associative, i.e.
      <code>a -> b -> c</code>
      is equivalent to
      <code>(a -> b) -> c</code>
      .
    </li>
    <li>
      Labels or agent names can be surrounded with quotation marks if they
      contain characters that would conflict with the operator syntax.
      <br />
      For example,
      <code>"osx (10.11)" || "Windows Server"</code>
      .
    </li>
    <li>
      Expressions can be written without whitespace, but including it is
      recommended for readability; Jenkins will ignore whitespace when
      evaluating expressions.
    </li>
    <li>
      Matching labels or agent names with wildcards or regular expressions is
      not supported.
    </li>
    <li>
      An empty expression will always evaluate to
      <i>true</i>
      , matching all agents.
    </li>
  </ul>

  <h3>Examples</h3>
  <dl>
    <dt><code>built-in</code></dt>
    <dd>Builds of this project may be executed only on the built-in node</dd>
    <dd></dd>

    <dt><code>linux-machine-42</code></dt>
    <dd>
      Builds of this project may be executed only on the agent with the name
      <code>linux-machine-42</code>
      (or on any machine that happens to have a label called
      <code>linux-machine-42</code>
      )
    </dd>

    <dt><code>windows &amp;&amp; jdk9</code></dt>
    <dd>
      Builds of this project may be executed only on any Windows agent that has
      version 9 of the Java Development Kit installed (assuming that agents with
      JDK 9 installed have been given a
      <code>jdk9</code>
      label)
    </dd>

    <dt><code>postgres &amp;&amp; !vm &amp;&amp; (linux || freebsd)</code></dt>
    <dd>
      Builds of this project may be executed only any on Linux or FreeBSD agent,
      so long as they are
      <i>not</i>
      a virtual machine, and they have PostgreSQL installed (assuming that each
      agent has the appropriate labels — in particular, each agent running in a
      virtual machine must have the
      <code>vm</code>
      label in order for this example to work as expected)
    </dd>
  </dl>
</div>
